<?php
class SocialConnectHelper extends AppHelper
{
	var $facebookStaticUrl = "http://static.ak.connect.facebook.com";
	var $helpers = array('Html');
	
	function beforeRender()
	{
		//$this->addFacebookJs();
		parent::beforeRender();
	}
	
	function facebookLogin($size="small",$text="",$onLogin=null)
	{
		
		if($onLogin==null)
		{

		}
		return '<fb:login-button v="2" '.
           		'size="'.$size.'" background="light" length="long" '.
           		'onlogin="FacebookUtility.onLogin('.$onLogin.');">'.$text.'</fb:login-button>';
	}
	/*
	function facebookOfflineAccess()
	{
		
	}*/

	function getFacebookJs()
	{
		$html = sprintf(
   					 '<script src="%s/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
    				 <script type="text/javascript">
     		  			FB.init("%s", "%s");
    				 </script>
     				<script src="%s" type="text/javascript"></script>',
		$this->facebookStaticUrl,
		Configure::read('cmsConfig.Sociable.facebook_key'),
		$this->Html->url(array("controller"=>"sociable","plugin"=>"sociable","action"=>"xd_reciver",'admin'=>false)),
		$this->Html->url("/sociable/js/social_connect.js"));
		return $html;
	}
}
?>